package indi.onem.two.datetype;
class BreakWithLabelDemo {
	public static void main(String[] args) {

//		test_arrayOfIndex();
		test_arrayOfIndex01();
	}

	private static void test_arrayOfIndex01() {
		int[][] arrayOfIndex={	{ 32, 87, 3, 589 },
				{ 12, 1076, 2000, 8 },
				{ 622, 127, 77, 955 }};
		int i=0,j=0;
		int searchIndex = 12;
		boolean flag =false;
		ok:
			for ( i = 0; i < arrayOfIndex.length; i++) {
				for ( j = 0; j < arrayOfIndex[i].length; j++) {
					if (arrayOfIndex[i][j] == searchIndex) {
						flag =true;
						break ok;
					}
				}
			}

		if (flag) {
			System.out.println(searchIndex + " :::" + i+":"+j );
		}else System.out.println("not found");

	}

	private static void test_arrayOfIndex() {
		int[][] arrayOfInts = { 
				{ 32, 87, 3, 589 },
				{ 12, 1076, 2000, 8 },
				{ 622, 127, 77, 955 }
		};
		int searchfor = 12;

		int i;
		int j = 0;
		boolean foundIt = false;

		search:
			for (i = 0; i < arrayOfInts.length; i++) {
				for (j = 0; j < arrayOfInts[i].length;j++) {
					if (arrayOfInts[i][j] == searchfor) {
						foundIt = true;
						break search;
					}
				}
			}

		if (foundIt) {
			System.out.println("Found " + searchfor + " at " + i + ", " + j);
		} else {
			System.out.println(searchfor + " not in the array");
		}
	}
}